#make main skd test data -- recall that the test is out of 500 points so <5 == <1
analysis_df_skd_1 <- analysis_df_subset %>% filter(abs(forcing_skd) < 5)

analysis_df_final_1 <- analysis_df_subset %>% filter(abs(forcing_final) < 1)

#for some of the analyses in the appendix, the bandwidth is expanded from a single percentage point 
#to ten percentage points, which increases the sample to nearly 100,000 individuals. to minimize the possibility of respondents being identified using covariates,
#for these analyses, i provide only the variables needed to recreate the analyses

analysis_df_skd_10  <- 
  analysis_df_subset %>% 
  filter(abs(forcing_skd) < 50) %>%
  dplyr::select(forcing_skd, fail_skd, java_indicator, 
                q16_survey_transparent_h2, q13_survey_success_reason_1_merit_h2, 
                q13_survey_success_reason_3_sara, q13_survey_success_reason_2_connection_h2,
                q14_survey_test_vs_connection,
                q17_survey_java1, q17_survey_java2, 
                q18_survey_daerah1, q18_survey_daerah2, q18_survey_daerah3, 
                q19_survey_relg1, q19_survey_relg2, q19_survey_relg3, 
                q20_survey_pancasila_h3, q21_survey_nation_ethnic_h3,
                java_index_skd_bw_5, non_java_index_skd_bw_5, regional_index_skd_bw_5, religious_index_skd_bw_5, 
                national_index_skd_bw_5, corruption_index_skd_bw_5,
                java_index_skd_bw_10, non_java_index_skd_bw_10, regional_index_skd_bw_10, religious_index_skd_bw_10, 
                national_index_skd_bw_10, corruption_index_skd_bw_10)

analysis_df_final_10  <- 
  analysis_df_subset %>% 
  filter(abs(forcing_final) < 10) %>%
  dplyr::select(forcing_final, pass_final, java_indicator, 
                q16_survey_transparent_h2, q13_survey_success_reason_1_merit_h2, 
                q13_survey_success_reason_3_sara, q13_survey_success_reason_2_connection_h2,
                q14_survey_test_vs_connection,
                q17_survey_java1, q17_survey_java2, 
                q18_survey_daerah1, q18_survey_daerah2, q18_survey_daerah3, 
                q19_survey_relg1, q19_survey_relg2, q19_survey_relg3, 
                q20_survey_pancasila_h3, q21_survey_nation_ethnic_h3,
                java_index_final_bw_5, non_java_index_final_bw_5, regional_index_final_bw_5, religious_index_final_bw_5, 
                national_index_final_bw_5, corruption_index_final_bw_5,
                java_index_final_bw_10, non_java_index_final_bw_10, regional_index_final_bw_10, religious_index_final_bw_10, 
                national_index_final_bw_10, corruption_index_final_bw_10)



#make data showing forcing variables

write.csv(analysis_df_skd_1, "./BKN survey/apsr_kuipers_replication_file/_3_data/1_data.csv")
write.csv(analysis_df_final_1, "./BKN survey/apsr_kuipers_replication_file/_3_data/2_data.csv")
write.csv(analysis_df_skd_10, "./BKN survey/apsr_kuipers_replication_file/_3_data/3_data.csv")
write.csv(analysis_df_final_10, "./BKN survey/apsr_kuipers_replication_file/_3_data/4_data.csv")



                